package cn.yitun.chat.yitunserverimapicore.business.contact.service.impl;

import cn.yitun.chat.yituncommonutil.YitunMapUtil;
import cn.yitun.chat.yitunservercommonlib.crud.yitun.CrudServiceImpl;
import cn.yitun.chat.yitunservercommonlib.dataentity.dto.contact.ContactAddApplyDto;
import cn.yitun.chat.yitunservercommonlib.dataentity.po.contact.ContactAddApplyInfo;
import cn.yitun.chat.yitunservercommonlib.dataentity.vo.contact.ContactAddApplyVo;
import cn.yitun.chat.yitunservercommonlib.util.R;
import cn.yitun.chat.yitunserverimapicore.business.contact.service.ContactAddApplyService;
import cn.yitun.chat.yitunserverimbase.dao.contact.ContactAddApplyDao;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Date 2019-01-20 22:30:07<br>
 * Description
 * 
 * @author yitun<br>
 * @version 1.1
 */
@Service
@Transactional
public class ContactAddApplyServiceImpl
		extends CrudServiceImpl<ContactAddApplyDao, ContactAddApplyDto, ContactAddApplyInfo, ContactAddApplyVo>
		implements ContactAddApplyService {


	/**
	 * 
	 * Date 2019-01-20 22:32:52<br>
	 * Description 获取用户被请求添加的列表
	 *
	 * @author yitun<br>
	 * @version 1.1
	 */
	public List<ContactAddApplyVo> getListByTargetUserId(Long targetUserId, int pageNo, int pageSize) {
		PageHelper.startPage(pageNo, pageSize);
		List<ContactAddApplyVo> list = dao.listVO(R.param("targetUserId", targetUserId));
		return list;
	}

	/**
	 * 分页筛选
	 * @param query
	 * @return
	 */
	public List<ContactAddApplyVo> queryList(ContactAddApplyDto query) {

		List<ContactAddApplyVo> list = dao.listVO(YitunMapUtil.java2Map(query, false));
		return list;
	}

}
